package org.fiel.struts.actions;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.fiel.helpers.Enums;

public class SectorialesAction extends ListaSubtiposAction
{
    private Logger logger = Logger.getLogger(SectorialesAction.class);
    
    public SectorialesAction()
    {
    }
    
    public ActionForward execute( ActionMapping mapping
                                , ActionForm form
                                , HttpServletRequest request
                                , HttpServletResponse response )
    throws Exception
    {
        String rol = obtenerRol(request);
        
        if(rol.indexOf("4") != -1)
        {
            List subtipos = this.ObtenerSubtipos(Enums.TIPO_SECTORIALES);
            List informacion = this.ObtenerInformacionSubtipos(subtipos, rol);
            
            if(informacion != null)
            {
                request.getSession().setAttribute("sectoriales", informacion);
            }
        }
        
        return mapping.findForward("listarSectoriales");
    }
    
}